/**
 * Created by Mark_ren on 2016/11/28.
 * 苟富贵,無相忘
 */
var moment = require("moment");
var co = require('co');
var seqModule = require('../../../routes/createModules');
var seq = new seqModule();
/**
 * 查询字典表信息
 * @param {*} req
 * @param {*} res
 */

var listByType = function (req, res) {
    var params = {};
    var paramT = {};
    try {
        paramT.attributes = ['codeId', 'codeDesc'];
        if (req.params.types != undefined) {
            params.types = parseInt(req.params.types);
        } else {
            res.json({
                "success": false,
                "msg": "空参错误！"
            });
        }
        paramT.where = params;
        paramT.order = [['num', 'asc']];
        seq.dictionaryModule.findAll(paramT).then(function (result) {
            res.json({
                "success": true,
                "msg": "查询成功！",
                "result": result
            });
        })
    } catch (err) {
        res.status(500).json({
            message: "服务错误！",
            err: err
        });
    }
}

exports.listByType = listByType;

